import Card from "@/components/Card";
import { getUserFromSession } from "@/lib/auth";
import { redirect } from "next/navigation";

export default async function ProfilePage() {
    const user = await getUserFromSession()
    if (!user) {
        redirect('/')
    }

    return (<>
        <div className={'relative'}>
            <img src="/files/profile.png" alt=""
                className={'opacity-85 h-80 w-full rounded-lg'} />
            <div className={'gap-3 absolute flex flex-row inset-y-52 inset-x-5'}>
                <img src="/files/avatar.jpg" alt="" className={'rounded-full h-24 w-24 '} />
                <div className={'flex flex-col '}>
                    <span className={'text-blue-400  text-2xl font-black mt-2 '}>{user.name}</span>
                    <span className={'text-blue-400  text-lg mt-1 '}>{user.desc}</span>
                </div>
            </div>
            <hr className="mt-2 border-solid border-2 border-teal-400" />
            <div className="mt-2 flex flex-col gap-2">
                <div >
                    <span className="text-xl">视频列表</span>
                </div>
                <div>
                    <ul className="justify-between flex flex-wrap flex-row">
                        {[1, 2, 3].map((v) => (
                            <li>
                                <Card type='normal' onlyImg id="3dcd0965-6de9-4918-a1a4-c7abaa291bca" />
                            </li>
                        ))}
                    </ul>
                </div>
            </div>
        </div>
    </>)
}